const xml2js = require('xml2js');
const fs = require('fs');

var xmlBuilder = new xml2js.Builder();

var jsonData = fs.createReadStream('city.json');

var data = '';

jsonData.on('data', rs =>{
    data += rs;
})

jsonData.on('end', ()=>{
    var xmlObj = JSON.parse(data);
    var strXml = xmlBuilder.buildObject(xmlObj);
    var writeStream = fs.createWriteStream('city_.xml');
    writeStream.write(strXml);
    writeStream.end();
})